#ifndef MPRBUILDER_H
#define MPRBUILDER_H

#include "plane.h"
#include "volumeInfo.h"

struct DICOMStruct;
class ImagePanel;

namespace mpr
{

class TVolume;
///////////////////////////////////////////////////////////
// TMPRBuilder ////////////////////////////////////////////
///////////////////////////////////////////////////////////
class TMPRBuilder : public QObject
{
	Q_OBJECT
public:
	TMPRBuilder();
	~TMPRBuilder();
	//
	bool initialize( QList<DICOMStruct*> imgList, const TVolumeInfo &volInfo, ImagePanel *panel );

	TDataSliceList reconstructPlane( const TPlaneInfo &plane, int number = 1
									, int spacing = 1, int thickness = 1 ) const;
	TDataSliceList reconstructPlane( const TPlaneInfo &plane, float upBound, float downBound
									, int spacing = 1, int thickness = 1 ) const;

	//
//	uint *convertToARGB( const TPlane &pl ) const;
	void convertToVladInt( TDataSlice &slice ) const;

signals:
	void setBounds(int, int);
	void sliceLoaded(int);

private:
	void setReferencePlane( DICOMStruct *dcmStr, ImagePanel *panel );
	bool checkImages( QList<DICOMStruct*> &imgList );
	void setPlanes( QList<DICOMStruct*> imgList, ImagePanel *panel );
	//
	TPlanesPack planesPack;
	TVolume *volume;

///////// **errors part** /////////////
public:
	bool error() { return !noError; }
	QString errorMessage() { return errorMsg; }

private:
	bool noError;
	QString errorMsg;
};

};//mpr

#endif // MPRBUILDER_H
